package healthcheckservicelogic

import (
	"context"
	"smile-sunshine-micorservice/rpc/User/db/crud"
	"smile-sunshine-micorservice/rpc/User/internal/svc"
	"smile-sunshine-micorservice/rpc/User/pb/zipTako.com/SmileSunshine/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type PingLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
	UsersModel crud.UsersModel
}

func NewPingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PingLogic {
	return &PingLogic{
		ctx:        ctx,
		svcCtx:     svcCtx,
		Logger:     logx.WithContext(ctx),
		UsersModel: crud.NewUsersModel(svcCtx.SqlConn, svcCtx.CacheConf),
	}
}

// Ping 基础健康检查
func (l *PingLogic) Ping(in *user.Request) (*user.Response, error) {
	l.Logger.Info("收到健康检查请求")

	// TODO: 这里可以添加一些基础的健康检查逻辑
	// 例如: 检查数据库连接、缓存连接等

	return &user.Response{
		Pong: "pong",
	}, nil
}
